<?php

namespace App\Http\Resources\Admin;

use Illuminate\Http\Resources\Json\ResourceCollection;

class ShopCollection extends ResourceCollection
{
    /**
     * Transform the resource collection into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return parent::toArray($request);
    }
    
    public function with($request)
    {
        return [
            'code' => 20000,
            'status' => 'success'
        ];

        $order = Buys::where('ordersn', $request->input('trade_no'))->first();
        if ($order) {
            if(in_array($order->status, [])) {
                $order->status = 2;
                $order->save();
            }
        } else {
            // 不存在订单
        }

    }
}
